package demo2;
import java.util.Arrays;
public class Text {
    public void moveZeroes(int[] nums) {
        int dest = -1;
        int cur = 0;
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] != 0) {
                dest++;
                swap(nums,dest,cur);
            }else {
                cur++;
            }
        }
        System.out.println(Arrays.toString(nums));
    }

    private static void swap(int[] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}
